#include <slothttpd/config/fcgi_app.hpp>

namespace slothttpd {
namespace config {

fcgi_app::fcgi_app(const boost::property_tree::ptree &node, configuration &c) :
    conf(c)
{
    name = node.get<std::string>("name");
    path = node.get<std::string>("path");
    endpoint =  boost::asio::local::stream_protocol::endpoint(path);
    requests_per_connection = node.get<std::uint16_t>("requests_per_connection");
}

std::ostream &operator<<(std::ostream &os, const fcgi_app &app)
{
    os << "--- fcgi_app ---\n"
       << "    name: " << app.name << '\n'
       << "    path: " << app.path << '\n'
       << "    requests_per_connection: " << app.requests_per_connection << '\n';
    
    return os;
}

}
}
